<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateQuestionWrite extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('question_write', ['comment' => '问卷被访问填写表']);
        $table->addColumn('issue_question_id', 'string',array('limit' => 355, 'null' => true,'comment' => '问题id'))
            ->addColumn('issue_question_type', 'integer',array('limit' => 11, 'default' => 0, 'comment' => '类型'))
            ->addColumn('userAnswer', 'string',array('limit' => 330, 'null' => true, 'comment' => '回答'))
            ->addColumn('issue_question_answer_remark', 'string',array('limit' => 31, 'null' => true, 'comment' => '回答的答案需要备注时的备注信息'))
            ->addColumn('question_info_id', 'integer',array('limit' => 30,'default' => 0, 'comment' => '关联被访问这的信息id'))
            ->addColumn('questionnaire_id', 'integer',array('limit' => 30,'default' => 0, 'comment' => '问卷id'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();
    }
}
